<?php

namespace App;
use App\Model;

class Product extends Model
{
   // use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'id','describe', 'product_name','type_id','specifications','cost_price','retail_price','image'
    ];
    public function type(){
        return $this->belongsTo('App\ProductType','type_id','id');
        //return $this->hasOne('App\ProductType','id','type_id');
    }
//    public function type(){ //获取所有分类
//        return $this->hasMany('App\ProductType','id','type_id');
//    }
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */

}
